package com.zxx.pattern.iteratorPattern.iterator2;

import com.zxx.pattern.iteratorPattern.iterator2.old.MenuItem;

import java.util.List;

/**
 * @author zxx on 2021/4/8
 */
public class TestNew {

    public static void main(String[] args) {
        TVChanneMenu tvMenu = new TVChanneMenu();
        Iterator2 iterator2 = tvMenu.createIterator();
        while (iterator2.hasNext()) {
            MenuItem item = (MenuItem) iterator2.next();
            System.out.println(item.name);
        }

        FilmMenu filmMenu = new FilmMenu();
        Iterator2 iterator1 = filmMenu.createIterator();
        while (iterator1.hasNext()) {
            MenuItem item = (MenuItem) iterator1.next();
            System.out.println(item.name);
        }

    }

}
